package com.milhouz.bomberrokon.sprite;

import com.milhouz.bomberrokon.model.Tile;
import com.stickycoding.Rokon.Texture;

/**
 * Explosion sprite
 */
public class ExplosionTileSprite extends SolidObject {

	private static final int ANIME_EXPLOSION[] = { 1, 2, 3, 4, 5, 6 };
	private static final int ANIM_FRAME_TIME = 50;

	private boolean destroyWall = false;
	private Tile correspondingTile;

	public ExplosionTileSprite(float x, float y, Texture texture) {
		// calculate bomb coordonate following the bomber coordonate
		super(x, y, texture);
		super.animateCustom(ANIME_EXPLOSION, ANIM_FRAME_TIME, 2, false);
	}

	public ExplosionTileSprite(Tile correspondingTile, Texture texture) {
		// calculate bomb coordonate following the bomber coordonate
		super(correspondingTile.getTileX(), correspondingTile.getTileY(), texture);
		destroyWall = correspondingTile.isDestructable();
		this.correspondingTile = correspondingTile;
		super.animateCustom(ANIME_EXPLOSION, ANIM_FRAME_TIME, 2, false);
	}

	public boolean isFinished() {
		return !isAnimating();
	}

	public boolean isDestroyWall() {
		return destroyWall;
	}

	public Tile getCorrespondingTile() {
		return correspondingTile;
	}

}
